/**
 * Created by Administrator on 2016/11/29.
 */


//必须在服务器上才能看到效果！
window.onload = function () {
    loadingVideo();
}

//全景图参数配置函数
function loadingVideo() {

    var url = "rtsp://" + urlPara("account") + ":" + urlPara("password") + "@" + urlPara("url") + ":554/Streaming/Channels/101?transportmode=unicast";

    // var url = "rtsp://admin:admin123@192.168.201.112:554/Streaming/Channels/101?transportmode=unicast";//rtsp��Ƶ

    if (url) {
        theHtml = '<object type="application/x-vlc-plugin" pluginspage="http://www.videolan.org/" id="vlc" events="false" width="800" height="680">' +
            '<param name="mrl" value="' + url + '" />' +
            '<param name="volume" value="50" />' +
            '<param name="autoplay" value="true" />' +
            '<param name="loop" value="false" />' +
            '<param name="play" id="isPlay" value="true" />' +
            '<param name="fullscreen" value="false" />' +
            '<param name="controls" value="false" />' +
            '</object>';
    } else {
        theHtml = "暂无视频连接";
    }
    document.getElementById("player").innerHTML = theHtml;
    document.getElementById("vlc").width = 800;
    document.getElementById("vlc").width = 680;
}

function urlPara(key) {
    var name, value;
    var str = location.href; //取得整个地址栏
    str = decodeURI(str);
    var num = str.indexOf("?")
    str = str.substr(num + 1); //取得所有参数   stringvar.substr(start [, length ]

    var arr = str.split("&"); //各个参数放到数组里
    var paras = [];
    for (var i = 0; i < arr.length; i++) {
        num = arr[i].indexOf("=");
        if (num > 0) {
            name = arr[i].substring(0, num);
            value = arr[i].substr(num + 1);
            paras[name] = value;
        }
    }
    if (null != key) {
        return paras[key]
    }
    return paras;
};
